#include <stdio.h>
#include "ppm.h"

void writeppm(const char *filename, const color *buffer, const int w, const int h)
{
	FILE * f = fopen(filename, "w");
	fprintf(f, "P6 %d %d 255\n", w, h);
	for(int i = 0, l = w * h; i < l; i++)
		fwrite(&buffer[i], 3, 1, f);
	fclose(f);
}
